package cn.koala.key.fileupload.controller;

import cn.koala.key.fileupload.service.RepairImageUploadService;
import cn.seed.common.core.Result;
import cn.seed.web.jwt.JwtTokenAuthentication;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.annotations.ApiParam;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestParam;
import org.springframework.web.bind.annotation.RequestPart;
import org.springframework.web.bind.annotation.RestController;
import org.springframework.web.multipart.MultipartFile;

import javax.servlet.http.HttpServletRequest;

/**
 * @Description:附件上传控制器
 * @author:方典典
 * @time:2017年10月17日 上午11:04:04
 */
@Api(value = "RepairImageUpload", tags = "附件上传")
@RestController
public class RepairImageUploadController {

    @Autowired
    private RepairImageUploadService repairImageUploadService;

    @ApiOperation(value = "附件上传")
    @PostMapping("/newImgfile")
    public Result<String> newImgfile(@ApiParam("文件") @RequestPart MultipartFile file,
                                     @ApiParam("文件类型编号(必填)702维修厂图片 703维修图片") @RequestParam Integer categoryId,
                                     @RequestParam String referNo,
                                     @ApiParam("作者") @RequestParam String author) {
        return repairImageUploadService.newImgfile(file,categoryId,referNo,author);
    }

}
